
public class Supermarket {
    private ShoppingCart cart;
    private double discountAmount;  // 满减金额

    public Supermarket() {
        cart = new ShoppingCart();
        discountAmount = 0.0;  // 默认无满减
    }


    public void setDiscountAmount(double amount) {
        discountAmount = amount;
    }

    public void addFruit(Fruit fruit) {
        cart.addFruit(fruit);
    }

    public double calculateTotalPrice() {
        double totalPrice = cart.calculateTotalPrice();
        if (totalPrice >= 100.0) {
            totalPrice -= discountAmount;
        }
        return totalPrice;
    }
}
